// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'

/* 路由 */
import router from './router'

/* axios */
// import axios from './api'
// import api from './api/api'
// Vue.prototype.http = axios;
// Vue.prototype.api = api;
import axios from 'axios'
// import VueAxios from 'vue-axios'
Vue.prototype.$axios = axios
// axios.defaults.baseURL = '/api'
axios.defaults.baseURL = process.env.BASE_API;

axios.defaults.headers.post['Content-Type'] = 'application/json'
// Vue.use(VueAxios, axios)


// Vue.prototype.$axios = axios
// axios.defaults.baseURL = '/api'
// axios.defaults.headers.post['Content-Type'] = 'application/json'
// axios.defaults.headers.post['Content-Type'] = 'application/json'

/* elementui */
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

// iView
import iView from 'iview';
import 'iview/dist/styles/iview.css';
Vue.use(iView);

/* vuex */
import Vuex from 'vuex';
Vue.use(Vuex)

/* 地图 */
import VueAMap from 'vue-amap'
Vue.use(VueAMap)
Vue.config.productionTip = false
VueAMap.initAMapApiLoader({
  key: 'ef91e11466041b59e22aaf9b55df3f55', // 输入自己申请好的高德地图key
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor', 'AMap.Geolocation'],
  v: '1.4.4'
})

// utils公共方法
import utils from './utils/utils'
Vue.prototype.utils = utils

// 图片验证
import SlideVerify from 'vue-monoplasty-slide-verify';
Vue.use(SlideVerify);

/* swiper */
import 'swiper/dist/css/swiper.min.css';

/* 重置样式 */
import './assets/css/reset.min.css'

/* jquery */
import 'jquery'

/* bootstarp */
import './assets/css/bootstrap.min.css'
import './assets/js/bootstrap.min'

/* animate.css */
import 'animate.css'

/* store */
import store from './store'

/* 头部组件 */
import Header from './components/Header'
Vue.component(Header.name, Header)


/* 尾部组件 */
import Footer from './components/Footer'
Vue.component(Footer.name, Footer)

/* 回到顶部 */
import GoTop from './components/GoTop'
Vue.component(GoTop.name, GoTop)

Vue.config.productionTip = false


router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next();
});


new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})
